package com.coolw.dynamic.thread.pool.controller;

import com.coolw.common.api.BaseResult;
import com.coolw.common.api.PageResponse;
import com.coolw.dynamic.thread.pool.domain.dto.ThreadPoolStatDTO;
import com.coolw.dynamic.thread.pool.domain.request.ThreadPoolStatPageRequest;
import com.coolw.dynamic.thread.pool.service.ThreadPoolStatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 线程池配置请求控制层
 *
 * @author coolw
 * @date 2024/5/15 16:21
 */
@RequestMapping("/thread-pool-stat")
@RestController
public class ThreadPoolStatController {

    @Autowired
    private ThreadPoolStatService threadPoolStatService;

    @PostMapping("/pageList")
    public BaseResult<PageResponse<ThreadPoolStatDTO>> pageList(@RequestBody ThreadPoolStatPageRequest request) {
        return BaseResult.success(threadPoolStatService.pageList(request));
    }

    @GetMapping("/execute")
    public BaseResult<ThreadPoolStatDTO> execute() {
        return BaseResult.success(threadPoolStatService.execute());
    }
}
